Skip to content

Conversation

@daolq3012
Copy link
Owner

@daolq3012 daolq3012 commented Apr 10, 2018

CleanArchitectureMVVMRxSwift
base on: sergdort/CleanArchitectureRxSwift

switch result {
case .success(let response):
self?.navigator.toListUser(users: response?.users)
case .failure(_): break

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty Enum Arguments Violation: Arguments can be omitted when matching enums with associated types if they are not used. (empty_enum_arguments)

}

let inputRequest = Driver.combineLatest(input.keyword, input.limitNumber) {
(keyword, limitNumber) -> SearchRequest in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closure Parameter Position Violation: Closure parameters should be on the same line as opening brace. (closure_parameter_position)

let navigator = DefaultSearchNavigator(navigationController: self.navigationController)
viewModel = SearchViewModel(userRepository: userRepository, navigator: navigator)

let input = SearchViewModel.Input(keyword: searchTextField.rx.text.orEmpty.asDriver(), limitNumber: limitNumberTextField.rx.text.orEmpty.asDriver(), searchTrigger: searchButton.rx.tap.asDriver())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 203 characters (line_length)

func searchUsers(keyword: String, limit: Int, completion: @escaping (BaseResult<SearchResponse>) -> Void) {
let input = SearchRequest(keyword: keyword, limit: limit)

func searchUsers(input: SearchRequest, completion: @escaping (BaseResult<SearchResponse>) -> Void){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration. (opening_brace)

let activityIndicator = ActivityIndicator()

let canSearch = Driver.combineLatest(keywordAndLimitNumber, activityIndicator.asDriver())
{ (keywordAndLimitNumber, activityIndicator) in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration. (opening_brace)

}

func asDriverOnErrorJustComplete() -> Driver<E> {
return asDriver { error in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused Closure Parameter Violation: Unused parameter "error" in a closure should be replaced with _. (unused_closure_parameter)

completion(nil, BaseError.apiFailure(error: error))

return Observable.create {observer in
self.alamofireManager.request(input.url, method: input.requestType, parameters: input.body, encoding: input.encoding)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 129 characters (line_length)

} else {
completion(nil, BaseError.unexpectedError)
observer.on(.completed)
case .failure(_):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty Enum Arguments Violation: Arguments can be omitted when matching enums with associated types if they are not used. (empty_enum_arguments)

import RxCocoa

public class ActivityIndicator: SharedSequenceConvertibleType {
public typealias E = Bool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type Name Violation: Type name should be between 3 and 40 characters long: 'E' (type_name)

let activityIndicator = ActivityIndicator()

let canSearch = Driver.combineLatest(keywordAndLimitNumber, activityIndicator.asDriver())
{ (keywordAndLimitNumber, activityIndicator) in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration. (opening_brace)

}

func asDriverOnErrorJustComplete() -> Driver<E> {
return asDriver { error in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused Closure Parameter Violation: Unused parameter "error" in a closure should be replaced with _. (unused_closure_parameter)

completion(nil, BaseError.apiFailure(error: error))

return Observable.create {observer in
self.alamofireManager.request(input.url, method: input.requestType, parameters: input.body, encoding: input.encoding)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 129 characters (line_length)

} else {
completion(nil, BaseError.unexpectedError)
observer.on(.completed)
case .failure(_):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty Enum Arguments Violation: Arguments can be omitted when matching enums with associated types if they are not used. (empty_enum_arguments)

Repository owner deleted a comment from houndci-bot Apr 12, 2018
Repository owner deleted a comment from houndci-bot Apr 12, 2018
Repository owner deleted a comment from houndci-bot Apr 12, 2018
Repository owner deleted a comment from houndci-bot Apr 12, 2018
Repository owner deleted a comment from houndci-bot Apr 12, 2018
}).mapToVoid()

return SearchViewModel.Output(searchButtonEnable: canSearch, errorInputNumber: errorInputNumber,
search: search, error: errorTracker.asDriver(), dissmiss: activityIndicator.asDriver())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 125 characters (line_length)

}

var errorBinding: Binder<Error> {
return Binder(self, binding: { (vc, error) in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'vc' (identifier_name)

}
}
var errorInputNumberBinding: Binder<String> {
return Binder(self, binding: { (vc, errorText) in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'vc' (identifier_name)


/// Bindable sink for `show()`, `hide()` methods.
public static var isAnimating: Binder<Bool> {
return Binder(UIApplication.shared) { progressHUD, isVisible in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused Closure Parameter Violation: Unused parameter "progressHUD" in a closure should be replaced with _. (unused_closure_parameter)

}).mapToVoid()

return SearchViewModel.Output(searchButtonEnable: canSearch, errorInputNumber: errorInputNumber,
search: search, error: errorTracker.asDriver(), dissmiss: activityIndicator.asDriver())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 125 characters (line_length)

}

var errorBinding: Binder<Error> {
return Binder(self, binding: { (vc, error) in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'vc' (identifier_name)

}
}
var errorInputNumberBinding: Binder<String> {
return Binder(self, binding: { (vc, errorText) in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'vc' (identifier_name)


/// Bindable sink for `show()`, `hide()` methods.
public static var isAnimating: Binder<Bool> {
return Binder(UIApplication.shared) { progressHUD, isVisible in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused Closure Parameter Violation: Unused parameter "progressHUD" in a closure should be replaced with _. (unused_closure_parameter)

@daolq3012 daolq3012 force-pushed the mvvm_architect branch 2 times, most recently from 7f98926 to 776251c Compare April 12, 2018 13:52
}
}
var errorBinding: Binder<Error> {
return Binder(self, binding: { (vc, error) in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'vc' (identifier_name)

}

var errorInputNumberBinding: Binder<String> {
return Binder(self, binding: { (vc, errorText) in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'vc' (identifier_name)

print(user)
}
let output = viewModel.transform(input: input)
output.users.drive(tableView.rx.items(cellIdentifier: ListUsersTableViewCell.reuseID, cellType: ListUsersTableViewCell.self)) { (_, viewModel, cell) in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 159 characters (line_length)


let userItemViewModels = Observable.just(self.users).asDriverOnErrorJustComplete()
.map { $0.map { UserItemViewModel(with: $0) }}
let selectedCell = input.selection.withLatestFrom(userItemViewModels) { (indexPath, userItemViewModels) -> User in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 122 characters (line_length)

let userItemViewModels = Observable.just(self.users).asDriverOnErrorJustComplete()
.map { $0.map { UserItemViewModel(with: $0) }}
let selectedCell = input.selection.withLatestFrom(userItemViewModels)
{ (indexPath, userItemViewModels) -> User in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration. (opening_brace)

@daolq3012 daolq3012 force-pushed the mvvm_architect branch 2 times, most recently from 5147a89 to 1a2c86c Compare April 13, 2018 18:00
break
}
}, usingThreshold: UInt64.init(), to: input.url) { (result) in
switch result{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration. (opening_brace)

}
break
}
}, usingThreshold: UInt64.init(), to: input.url) { (result) in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple Closures with Trailing Closure Violation: Trailing closure syntax should not be used when passing more than one closure argument. (multiple_closures_with_trailing_closure)

@daolq3012 daolq3012 force-pushed the mvvm_architect branch 3 times, most recently from 2db03db to 8fe33e7 Compare April 19, 2018 04:42
(cell as! ListUsersTableViewCell).bind(viewModel: element)
} else {
cell = tableView.dequeueReusableCell(withIdentifier: ListUsersTableViewCell.reuseID, for: indexPath)
(cell as! ListUsersTableViewCell).bind(viewModel: element)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force Cast Violation: Force casts should be avoided. (force_cast)

var cell: UITableViewCell!
if indexPath.row == 1 {
cell = tableView.dequeueReusableCell(withIdentifier: ListUsersTableViewCell.reuseID, for: indexPath)
(cell as! ListUsersTableViewCell).bind(viewModel: element)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force Cast Violation: Force casts should be avoided. (force_cast)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants